home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
fish
/
001-100
/
001-025
/
005
/
proctest
/
littleproc.c
next >
Wrap
C/C++ Source or Header
|
1995-03-17
|
3KB
|
94 lines
/*
*
* DISCLAIMER:
*
* This program is provided as a service to the programmer
* community to demonstrate one or more features of the Amiga
* personal computer. These code samples may be freely used
* for commercial or noncommercial purposes.
*
* Commodore Electronics, Ltd ("Commodore") makes no
* warranties, either expressed or implied, with respect
* to the program described herein, its quality, performance,
* merchantability, or fitness for any particular purpose.
* This program is provided "as is" and the entire risk
* as to its quality and performance is with the user.
* Should the program prove defective following its
* purchase, the user (and not the creator of the program,
* Commodore, their distributors or their retailers)
* assumes the entire cost of all necessary damages. In
* no event will Commodore be liable for direct, indirect,
* incidental or consequential damages resulting from any
* defect in the program even if it has been advised of the
* possibility of such damages. Some laws do not allow
* the exclusion or limitation of implied warranties or
* liabilities for incidental or consequential damages,
* so the above limitation or exclusion may not apply.
*
*/
/* sample slave code for create process test */
/* author: Rob Peck 1/4/86, using exec_support task functions. */
/* system software version: V1.1 */
#include "exec/types.h"
#include "exec/nodes.h"
#include "exec/lists.h"
#include "exec/libraries.h"
#include "exec/ports.h"
#include "exec/interrupts.h"
#include "exec/io.h"
#include "libraries/dos.h"
#include "libraries/dosextens.h"
#include "workbench/startup.h"
/* these are going to be supplied to the slave by the starter */
extern int stdout;
extern int stderr;
struct mymess {
struct Message sysmess;
int outpointer;
int errpointer;
};
extern struct Message *GetMsg();
extern struct Task *FindTask();
main()
{
int type; /* type of message received */
int waitforeverSignal;
struct mymess *msg;
struct MsgPort *myport;
struct Process *myprocess;
myprocess = (struct Process *)FindTask(0);
myport = &myprocess->pr_MsgPort;
WaitPort(myport); /* wait for starter to post a message. */
/* Special sample message has his stderr,
* stdout so we can both post stuff to
* the same window */
msg = (struct mymess *)GetMsg(myport);
stdout = msg->outpointer;
stderr = msg->errpointer;
ReplyMsg(msg);
/* use printf to prove that it is really a process... a task
* cannot do this without crashing */
printf("\nHere I am, that slave task you started!!! bye!");
} /* now simply fall off the end of the world, should return cleanly */